
<form id="GoodsForm" data-auto="true" method="post" action="{:request()->url()}" class='layui-form layui-card res_field_form' lay-filter="form_sub" autocomplete="off">
    <div class="layui-card-body think-box-shadow padding-left-40">

        <label class="layui-col-xs9 relative">
            <span class="color-green">新闻分类</span>

            <select class="layui-select" required name="cate_id"   lay-search>
                <option selected value="">请选择分类</option>
                {foreach $news_category as $cate}
                {if isset($vo.cate_id) and $vo.cate_id eq $cate.id}
                <option selected value="{$cate.id}" >{$cate.name|default=''}</option>
                {else}
                <option value="{$cate.id}">{$cate.name|default=''}</option>
                {/if}
                {/foreach}
            </select>
        </label>
        <div class="layui-form-item layui-row layui-col-space15">
            <span class="color-green label-required-prev">新闻标题</span>
            <input name="title"  required class="layui-input" placeholder="请输入新闻标题" value="{$vo.title|default=''}">
        </div>

        <div class="layui-form-item">
            <span class="color-green label-required-prev">新闻LOGO及轮播展示图片</span>
            <table class="layui-table">
                <thead>
                <tr>
                    <th class="text-center">LOGO</th>
                    <th class="text-left">展示图片</th>
                </tr>
                <tr>
                    <td width="90px" class="text-center"><input name="logo" type="hidden" value="{$vo.logo|default=''}"></td>
                    <td width="auto" class="text-left"><input name="imgs" type="hidden" value="{$vo.imgs|default=''}"></td>
                </tr>
                </thead>
            </table>
            <script>$('[name="logo"]').uploadOneImage(), $('[name="imgs"]').uploadMultipleImage()</script>
        </div>

        <div class="layui-form-item block">
            <span class="label-required-prev color-green">新闻详细内容</span>
            <textarea name="content">{$vo.content|default=''|raw}</textarea>
        </div>
        <div class="layui-form-item text-center">
            {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
            <button class="layui-btn" type="submit" lay-submit lay-filter="form_sub">保存</button>
            <button class="layui-btn layui-btn-danger" id="backBtn" data-confirm="确定要取消吗？" data-close type="button">取消</button>
        </div>
    </div>

    </div>
</form>
<script>
    window.form.render();
    require(['ckeditor', 'angular'], function () {
        window.createEditor('[name="content"]', {height: 300});

        // 监听返回按钮的点击事件
        document.getElementById('backBtn').onclick = function(){
            layer.confirm('确定要取消编辑吗？', function(index){
                history.back(); // 执行浏览器的返回操作
                layer.closeAll();
            })
        };
    })
</script>

